package com.ruoyi.yfdw.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.yfdw.domain.DictDetail;
import com.ruoyi.yfdw.service.iDictDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : zll
 * @date : 2024/11/23 0:20/**
 * @BelongsProject: ruoyi
 * @BelongsPackage: com.ruoyi.yfdw.controller
 * @Description: TODO
 * @Author: zll
 * @CreateTime: 2024/11/23 00:20
 * @Version 1.0
 **/
@RestController
@RequestMapping("/report/yfdw/dict/detail")
@Api("字典详情接口")
@Slf4j
public class DictDetailController extends BaseController {

    @Autowired
    private iDictDetailService dictDetailService;

    @GetMapping("/test")
    public AjaxResult testDictDetail() {
        return AjaxResult.success("success");
    }

    @ApiOperation(value = "根据字典分组代码和字典代码查询字典详情")
    @GetMapping("/getDictDetailByDictGroupCodeAndDictCode/{dictGroupCode}/{dictCode}")
    public AjaxResult getDictDetailByDictGroupCodeAndDictCode(@PathVariable String dictGroupCode, @PathVariable String dictCode) {
        log.info("dictGroupCode={},dictCode={}", dictGroupCode, dictCode);
        List<DictDetail> dictDetail = dictDetailService.getDictDetailByDictGroupCodeAndDictCode(dictCode);
        log.info("dictDetail={}", dictDetail);
        return AjaxResult.success(dictDetail);
    }
}
